package com.clarence.dada.modular.system.role.service.impl;

import cn.hutool.core.collection.ListUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.clarence.dada.modular.system.role.entity.SysRoleMenuButtonEntity;
import com.clarence.dada.modular.system.role.mapper.SysRoleMenuButtonMapper;
import com.clarence.dada.modular.system.role.service.SysRoleMenuButtonService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 角色按钮关联 服务实现类
 *
 * @author fengshuonan
 * @date 2021/01/09 11:48
 */
@Service
public class SysRoleMenuButtonServiceImpl extends ServiceImpl<SysRoleMenuButtonMapper, SysRoleMenuButtonEntity> implements SysRoleMenuButtonService {

    @Override
    public void batchSaveRoleMenuButton(List<SysRoleMenuButtonEntity> roleMenuButtons) {
        List<List<SysRoleMenuButtonEntity>> split = ListUtil.split(roleMenuButtons, 100);
        for (List<SysRoleMenuButtonEntity> roleMenuButtonList : split) {
            this.getBaseMapper().insertBatchSomeColumn(roleMenuButtonList);
        }
    }

}
